/**
 * Created by gaoyj on 2018/6/28.
 */
window.onload = function (ev) {
    topbar.hide();
};
var myDate = new Date();
var month = myDate.getMonth() + 1;
var day = myDate.getDate();
if (month < 10) {
    month = "0" + month;
}
if (day < 10) {
    day = "0" + day;
}
var _start = myDate.getFullYear() + '-' + month + '-' + day + " 00:00:00";
var _end = myDate.getFullYear() + '-' + month + '-' + day + " 23:59:59";
$("#startTime").val(_start);
$("#endTime").val(_end);
laydate.render({
    elem: '#startTime',
    type: 'datetime',

});
laydate.render({
    elem: '#endTime' //指定元素
    , type: 'datetime',
});
var adminRole = roleCheck();
$('#dataTable').bootstrapTable({
    url: '/UserController/queryEquityCreditModify',
    height: $(window).height() - 200,
    pageSize: 100,
    pagination: true,
    pageList: [30, 50, 100],
    clickToSelect: true,
    queryParams: queryParams,
    uniqueId: 'id',
    queryParamsType: '',
    sidePagination: 'server',
    responseHandler: function (res) {
        return {
            "total": res.total,//总页数
            "rows": res.resultList   //数据
        };
    },
    onClickRow: function (row) {
        if (row.account != null && row.account != '') {
            $("#account_field" + row.id).html(row.account);
        }
    },
    columns: [[
        {
            checkbox: true,
            align: 'center'
        }, {
            width: '3px',
            align: 'center',
            formatter: function (v, row, index) {
                return index + 1
            }
        },
        {
            field: 'account',
            title: '会员编号',
            width: 50,
            align: 'center',
            formatter: function (v, o) {
                return copyAddon(v) + (adminRole == 1 ? v : userAccountHidden(o.account, o.id));
            }
        }, {
            field: 'originalCredit',
            title: '原权益信用分',
            width: 50,
            align: 'center'
        }, {
            field: 'newCredit',
            title: '新权益信用分',
            width: 50,
            align: 'center'
        }, {
            field: 'admin',
            title: '操作人',
            width: 50,
            align: 'center'
        }, {
            field: 'modifyTime',
            title: '操作时间',
            width: 50,
            align: 'center'
        },
        {
            field: 'remark',
            title: '操作原因',
            width: 50,
            align: 'center'
        },
    ]]
});

function queryParams(params) {
    return {
        account: $.trim($('#account').val()),
        page: params.pageNumber,
        size: params.pageSize,
        startTime: $("#startTime").val(),
        endTime: $("#endTime").val()
    };
}

$("#search").click(function () {
    $("#dataTable").bootstrapTable("refresh");
});





